# coding: utf-8
from django.db import transaction
from django.http import HttpResponseRedirect, JsonResponse
from django.conf import settings
import redis


class DBService(object):
    @classmethod
    def get_redis_db(cls, db=0):
        r = redis.Redis(host='localhost', port=6379, db=db)
        return r

    @classmethod
    def get_activity_users_count(cls):
        redis_db = cls.get_redis_db()
        activity_users_count = redis_db.llen(settings.REDIS_USERS_KEY)
        return activity_users_count